package com.jinx.time;

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;

/**
 * @author Jinx
 * @date 2021/6/10 9:28
 */
public class LocalDateTimeDemo {
    public static void main(String[] args) {
        LocalDateTimeDemo.timeDiff();
    }


    /**
     *  两个LocalDateTime的时间差
     *  ChronoUnit：前者时间小于后者时间计算出来的才是正数
     */
    public static void timeDiff(){
        LocalDateTime time = LocalDateTime.of(2021, 6, 9, 14, 56);

        System.out.println(ChronoUnit.HOURS.between(time, LocalDateTime.now()));
    }
}
